package com.cqrt.constant;

import com.hustcad.plm.pdm.core.handle.exception.ErrorCodeEnum;
import com.hustcad.plm.pdm.core.handle.exception.MessageException;
import lombok.Getter;

import java.util.Locale;

/**
 * Description 自定义错误枚举类
 *
 * @auther: xxx
 * @date: xxx
 */
@Getter
public enum RTErrorCodeEnum implements ErrorCodeEnum {

    // 文档类型转换异常
    PROJECT_NOT_EXIST(10001,"project.not.exist.error","","INFO"),
    DOC_NOT_EXIST(10002,"doc.not.exist.error","","INFO"),
    DOC_TYPE_ERROR(10003, "rtplm.doc.type.error","","INFO"),
    REMOTEOBJ_NOT_EXIST(10004, "remoteobj.not.exist.error","","INFO"),
    TEMPLATE_IMPORT_ERROR(10005, "template.import.error","","INFO"),
    JOB_NOT_EXIST(10006, "job.not.exist.error","","INFO"),
    NAME_NOT_VALID(10007, "name.not.valid.error","","INFO"),
    RELATIONJOB_NOT_COMPLETE(10008, "job.not.complete.error","","INFO"),
    JOB_SUBMIT_FAILED(10009, "job.not.submit.error","","INFO"),
    FORBID_REPETITION_NAME(10010, "forbid.repetition.name.error","","INFO"),
    EXIST_EXECUTE_ERROR(100011, "exist.execute.error","","INFO"),
    ANYSUBMISSION_UNIQUE_ERROR(100012, "anysubmission.unique.error","","INFO"),
    PROJECT_ACTIVE_ERROR(100013, "project.active.error","","INFO"),
    GROUP_NOT_EXIST(100014, "group.not.exist.error","","INFO"),
    MASTER_NOT_EXIST(100015, "master.not.exist.error","","INFO"),
    SLAVE_NOT_EXIST(100016, "slave.not.exist.error","","INFO"),
    SLAVE_AFTER_MASTER(100017, "slave.after.master.error","","INFO"),
    TYPEOBJ_NOT_EXIST(100018, "obj.not.exist.error","","INFO"),
    EXECUTOR_NOT_EXIST_GROUP(100019, "executor.not.exist.group.error","","INFO"),
    PROJECT_TYPE_NOT_EXIST(100020, "type.not.exist.error","","INFO"),
    USER_NOT_EXIST(100021, "user.not.exist.error","","INFO"),
    DAY_NOT_VALID(100022, "day.not.valid.error","","INFO"),
    PLAN_PUBLISH_START_ERROR(100023, "plan.publish.start.error","","INFO"),
    EXECUTOR_NOT_EXIST(100024, "executor.not.exist.error","","INFO"),
    ERR_NAME(100026, "err.name","","INFO"),
    PLAN_PUBLISH_PAUSE_ERROR(100025, "plan.publish.pause.error","","INFO"),
    PLAN_DELETE_ERROR(100027, "plan.delete.error","","INFO"),
    OUTRULE_DELETE_ERROR(100033, "outrule.delete.error","","INFO"),
    UPDATA_PROJECT_MANAGER_ERROR(100028, "update.project.manager.error","","INFO"),
    PRE_TASK_ERROR(100028, "pre.task.error","","INFO"),
    RELATIONSHIP_TASK_IS_NOT_COMPLETE_ERROR(100029, "relationship.error","","INFO"),
    UPDATE_PROJECT_MEMBER_ERROR(12030, "update.project.member.error", "", "ERROR"),
    PROJECT_IN_APPROVAL(12031, "project.in.approval.error", "", "ERROR"),
    PROJECT_NOT_FOUND(12033, "project.not.found.error", "", "ERROR"),
    RT_NON_EFFECTIVE(100030, "存在状态非已生效的交付物，禁止提交","","INFO"),
    RT_NON_PROJECT(10031, "任务不存在，无法校验交付物规则状态", "","INFO"),
    DOC_EXIST_MULTIPLE(10032,"doc.exist.multiple","","INFO"),
    TASK_FIRST_ERROR(12034,"task.first.error","","INFO"),
    EXCEL_IMPORT_ERROR(12034,"excel.import.error","","INFO"),
    REPETITIVE_TYPE(12035,"repetitive.type","","INFO"),
    TASK_HAS_RISK(12036,"task.has.risk","","INFO"),
    PROJECT_PERSON_ERROR(12037,"project.person.error","","INFO"),
    PROJECT_ORDER_ERROR(12038,"project.order.error","","INFO"),
    PROJECT_PERMISSON_ERROR(12039,"project.permission.error","","INFO"),
    CHECK_USER_ERROR(12040,"check.user.error","","INFO"),
    CHECK_ORDER_ERROR(12041,"check.order.error","","INFO"),
    KNOW_NOT_DELETE(12042,"know.not.delete","","INFO"),
    KNOW_IS_REPEAT(12043,"know.is.repeat","","INFO"),
    KNOW_IS_TEMPLATE(12044,"know.is.template","","INFO"),
    CREATE_PJ_ERROR(12045,"create.pj.error","","INFO"),
    PROJECT_DATE_ERROR(12046,"project.date.error","","INFO"),
    PROJECT_PARAMETER_NOT_EXIST(12047,"project.parameter.not.exist","","INFO"),
    PLAN_OUTRULE_SAME(12048,"plan.outrule.same","","INFO"),
    ;



    private int code;
    private String msg;
    private String enMsg;
    private String type;

    private RTErrorCodeEnum(int code, String msg, String enMsg, String type) {
        this.code = code;
        this.msg = msg;
        this.enMsg = enMsg;
        this.type = type;
    }

    public int getCode() {
        return this.code;
    }

    public ErrorCodeEnum setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return this.msg;
    }

    public ErrorCodeEnum setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public String getEnMsg() {
        return this.enMsg;
    }

    public ErrorCodeEnum setEnMsg(String enMsg) {
        this.enMsg = enMsg;
        return this;
    }

    public String getType() {
        return this.type;
    }

    public ErrorCodeEnum setType(String type) {
        this.type = type;
        return this;
    }

    public MessageException build() {
        return new MessageException(this);
    }

    public MessageException message(Object... args) {
        return args != null && args.length != 0 ? new MessageException(this, Locale.SIMPLIFIED_CHINESE, args) : new MessageException(this, Locale.SIMPLIFIED_CHINESE);
    }


}